<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        早上好
    </div>
    <img src="/Users/D盘/JavaScript练习/picture/IMG_3905.GIF" >
    <script>
        var div1 = document.querySelector('div');
        var img = document .querySelector('img');
        var date = new Date();
        var newtime = date.getHours();
        if(newtime<12){
            div1.innerText = '早上好';
            img.src ="/Users/D盘/JavaScript练习/picture/IMG_3895.GIF"
        } else if(newtime<18){
            div1.innerText = '下午好';
            img.src = "/Users/D盘/JavaScript练习/picture/IMG_3905.GIF";
        }
    </script>
</body>
</html>